package com.java1234.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.java1234.model.Category;
import com.java1234.model.Grade;
import com.java1234.model.Message;
import com.java1234.model.PageBean;
import com.java1234.util.StringUtil;


public class MessageDao {
	//查詢dao
	public ResultSet messageList(Connection con,PageBean pageBean,Message message)throws Exception{
		StringBuffer sb=new StringBuffer("select * from message");
		
		if(message.getId()!= 0){
			//sb.append(" and id like '%"+message.getId()+"%' ");
			sb.append(" and id = "+message.getId());
		}
		if(StringUtil.isNotEmpty(message.getHead())){
			sb.append(" and head like '%"+message.getHead()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getWorkspace())){
			sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getName())){
			sb.append(" and name like '%"+message.getName()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getMembers())){
			sb.append(" and members like '%"+message.getMembers()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getAid())){
			sb.append(" and aid like '%"+message.getAid()+"%' ");
		}
		if(pageBean!=null){
			sb.append(" limit "+pageBean.getStart()+","+pageBean.getRows());
		}
		PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
		return pstmt.executeQuery();
	}	
	//查询已立项数据
	public ResultSet confirmMessageList(Connection con,PageBean pageBean,Message message)throws Exception{
		StringBuffer sb=new StringBuffer("select * from message where is_confirm='已立项'");
		if(message.getId()!= 0){
			//sb.append(" and id like '%"+message.getId()+"%' ");
			sb.append(" and id = "+message.getId());
		}
		if(StringUtil.isNotEmpty(message.getHead())){
			sb.append(" and head like '%"+message.getHead()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getWorkspace())){
			sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getName())){
			sb.append(" and name like '%"+message.getName()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getMembers())){
			sb.append(" and members like '%"+message.getMembers()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getAid())){
			sb.append(" and aid like '%"+message.getAid()+"%' ");
		}
		if(pageBean!=null){
			sb.append(" limit "+pageBean.getStart()+","+pageBean.getRows());
		}
		//PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
		PreparedStatement pstmt=con.prepareStatement(sb.toString());
		return pstmt.executeQuery();
	}
	//查询已提交数据
		public ResultSet submitMessageList(Connection con,PageBean pageBean,Message message)throws Exception{
			StringBuffer sb=new StringBuffer("select * from message where is_confirm='已立项' and submit='已提交'");
			if(message.getId()!= 0){
				//sb.append(" and id like '%"+message.getId()+"%' ");
				sb.append(" and id = "+message.getId());
			}
			if(StringUtil.isNotEmpty(message.getHead())){
				sb.append(" and head like '%"+message.getHead()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getWorkspace())){
				sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getName())){
				sb.append(" and name like '%"+message.getName()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getMembers())){
				sb.append(" and members like '%"+message.getMembers()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getAid())){
				sb.append(" and aid like '%"+message.getAid()+"%' ");
			}
			if(pageBean!=null){
				sb.append(" limit "+pageBean.getStart()+","+pageBean.getRows());
			}
			//PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
			PreparedStatement pstmt=con.prepareStatement(sb.toString());
			return pstmt.executeQuery();
		}
	//查询已结项数据
		public ResultSet endMessageList(Connection con,PageBean pageBean,Message message)throws Exception{
			StringBuffer sb=new StringBuffer("select * from message where is_confirm='已立项' and is_end='已结项' and submit ='已提交'");
			if(message.getId()!= 0){
				//sb.append(" and id like '%"+message.getId()+"%' ");
				sb.append(" and id = "+message.getId());
			}
			if(StringUtil.isNotEmpty(message.getHead())){
				sb.append(" and head like '%"+message.getHead()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getWorkspace())){
				sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getName())){
				sb.append(" and name like '%"+message.getName()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getMembers())){
				sb.append(" and members like '%"+message.getMembers()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getAid())){
				sb.append(" and aid like '%"+message.getAid()+"%' ");
			}
			PreparedStatement pstmt=con.prepareStatement(sb.toString());
			return pstmt.executeQuery();
		}
		//查询已获奖数据
				public ResultSet prizeMessageList(Connection con,PageBean pageBean,Message message)throws Exception{
					StringBuffer sb=new StringBuffer("select * from message where is_confirm='已立项' and is_end='已结项' and submit='已提交' and not prize='未获奖'");
					if(message.getId()!= 0){
						//sb.append(" and id like '%"+message.getId()+"%' ");
						sb.append(" and id = "+message.getId());
					}
					if(StringUtil.isNotEmpty(message.getHead())){
						sb.append(" and head like '%"+message.getHead()+"%' ");
					}
					if(StringUtil.isNotEmpty(message.getWorkspace())){
						sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
					}
					if(StringUtil.isNotEmpty(message.getName())){
						sb.append(" and name like '%"+message.getName()+"%' ");
					}
					if(StringUtil.isNotEmpty(message.getMembers())){
						sb.append(" and members like '%"+message.getMembers()+"%' ");
					}
					if(StringUtil.isNotEmpty(message.getAid())){
						sb.append(" and aid like '%"+message.getAid()+"%' ");
					}
					if(pageBean!=null){
						sb.append(" limit "+pageBean.getStart()+","+pageBean.getRows());
					}
					PreparedStatement pstmt=con.prepareStatement(sb.toString());
					return pstmt.executeQuery();
				}
	//查詢总條數
	public int messageCount(Connection con,Message message)throws Exception{
		StringBuffer sb=new StringBuffer("select count(*) as total from message");
		if(StringUtil.isNotEmpty(message.getDate())){
			sb.append(" and date like '%"+message.getDate()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getCid())){
			sb.append(" and cid like '%"+message.getCid()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getName())){
			sb.append(" and name like '%"+message.getName()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getM_desc())){
			sb.append(" and m_desc like '%"+message.getM_desc()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getWorkspace())){
			sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
		}
		PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
		ResultSet rs=pstmt.executeQuery();
		if(rs.next()){
			return rs.getInt("total");
		}else{
			return 0;
		}
	}
	//查詢搜索总條數
		public int messageSearchCount(Connection con,Message message)throws Exception{
			StringBuffer sb=new StringBuffer("select count(*) as total from message");
			//立项内搜索条数
			if(StringUtil.isNotEmpty(message.getIs_confirm())){
				sb.append(" and is_confirm like '%"+message.getIs_confirm()+"%' ");
			}
			//已提交内搜索条数 
			if(StringUtil.isNotEmpty(message.getSubmit())){
				sb.append(" and submit like '%"+message.getSubmit()+"%' ");
			}
			//已结项内搜索条数 
			if(StringUtil.isNotEmpty(message.getIs_end())){
				sb.append(" and is_end like '%"+message.getIs_end()+"%' ");
			}
			//已获奖内搜索条数 
			if(StringUtil.isNotEmpty(message.getPrize())){
				sb.append(" and not prize like '%"+message.getPrize()+"%' ");
			}
			if(message.getId()!= 0){
				//sb.append(" and id like '%"+message.getId()+"%' ");
				sb.append(" and id = "+message.getId());
			}
			if(StringUtil.isNotEmpty(message.getHead())){
				sb.append(" and head like '%"+message.getHead()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getWorkspace())){
				sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getName())){
				sb.append(" and name like '%"+message.getName()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getMembers())){
				sb.append(" and members like '%"+message.getMembers()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getAid())){
				sb.append(" and aid like '%"+message.getAid()+"%' ");
			}
			PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
			ResultSet rs=pstmt.executeQuery();
			if(rs.next()){
				return rs.getInt("total");
			}else{
				return 0;
			}
		}
	//查询立项条数
	public int messageConfirmCount(Connection con,Message message)throws Exception{
		StringBuffer sb=new StringBuffer("select count(*) as total from message where is_confirm='已立项'");
		if(message.getId()!= 0){
			//sb.append(" and id like '%"+message.getId()+"%' ");
			sb.append(" and id = "+message.getId());
		}
		if(StringUtil.isNotEmpty(message.getHead())){
			sb.append(" and head like '%"+message.getHead()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getWorkspace())){
			sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getName())){
			sb.append(" and name like '%"+message.getName()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getMembers())){
			sb.append(" and members like '%"+message.getMembers()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getAid())){
			sb.append(" and aid like '%"+message.getAid()+"%' ");
		}
		PreparedStatement pstmt=con.prepareStatement(sb.toString());
		ResultSet rs=pstmt.executeQuery();
		if(rs.next()){
			return rs.getInt("total");
		}else{
			return 0;
		}
	}
	//查询提交条数
		public int messageSubmitCount(Connection con,Message message)throws Exception{
			StringBuffer sb=new StringBuffer("select count(*) as total from message where is_confirm='已立项' and submit ='已提交'");
			if(message.getId()!= 0){
				//sb.append(" and id like '%"+message.getId()+"%' ");
				sb.append(" and id = "+message.getId());
			}
			if(StringUtil.isNotEmpty(message.getHead())){
				sb.append(" and head like '%"+message.getHead()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getWorkspace())){
				sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getName())){
				sb.append(" and name like '%"+message.getName()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getMembers())){
				sb.append(" and members like '%"+message.getMembers()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getAid())){
				sb.append(" and aid like '%"+message.getAid()+"%' ");
			}
			PreparedStatement pstmt=con.prepareStatement(sb.toString());
			ResultSet rs=pstmt.executeQuery();
			if(rs.next()){
				return rs.getInt("total");
			}else{
				return 0;
			}
		}
	//查询结项条数
		public int messageEndCount(Connection con,Message message)throws Exception{
			StringBuffer sb=new StringBuffer("select count(*) as total from message where is_confirm='已立项' and is_end='已结项' and submit='已提交'");
			if(message.getId()!= 0){
				//sb.append(" and id like '%"+message.getId()+"%' ");
				sb.append(" and id = "+message.getId());
			}
			if(StringUtil.isNotEmpty(message.getHead())){
				sb.append(" and head like '%"+message.getHead()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getWorkspace())){
				sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getName())){
				sb.append(" and name like '%"+message.getName()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getMembers())){
				sb.append(" and members like '%"+message.getMembers()+"%' ");
			}
			if(StringUtil.isNotEmpty(message.getAid())){
				sb.append(" and aid like '%"+message.getAid()+"%' ");
			}
			PreparedStatement pstmt=con.prepareStatement(sb.toString());
			ResultSet rs=pstmt.executeQuery();
			if(rs.next()){
				return rs.getInt("total");
			}else{
				return 0;
			}
		}
		//查询获奖条数
				public int messagePrizeCount(Connection con,Message message)throws Exception{
					StringBuffer sb=new StringBuffer("select count(*) as total from message where is_confirm='已立项' and submit='已提交' and is_end='已结项' and not prize='未获奖'");
					if(message.getId()!= 0){
						//sb.append(" and id like '%"+message.getId()+"%' ");
						sb.append(" and id = "+message.getId());
					}
					PreparedStatement pstmt=con.prepareStatement(sb.toString());
					ResultSet rs=pstmt.executeQuery();
					if(rs.next()){
						return rs.getInt("total");
					}else{
						return 0;
					}
				}
	//删除
	public int messageDelete(Connection con,String delIds)throws Exception{
		String sql="delete from message where id in("+delIds+")";
		PreparedStatement pstmt=con.prepareStatement(sql);
		return pstmt.executeUpdate();
	}

	//特等奖
		public int messagePrizeO(Connection con,String delIds)throws Exception{
			String sql="update message set prize='特等奖'  where id in("+delIds+")";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}
		//一等奖
		public int messagePrizeT(Connection con,String delIds)throws Exception{
			String sql="update message set prize='一等奖'  where id in("+delIds+")";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}
		//二等奖
		public int messagePrizeS(Connection con,String delIds)throws Exception{
			String sql="update message set prize='二等奖'  where id in("+delIds+")";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}
		//三等奖
		public int messagePrizeF(Connection con,String delIds)throws Exception{
			String sql="update message set prize='三等奖'  where id in("+delIds+")";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}
		//取消奖
				public int messagePrizeCancel(Connection con,String delIds)throws Exception{
					String sql="update message set prize='未获奖'  where id in("+delIds+")";
					PreparedStatement pstmt=con.prepareStatement(sql);
					return pstmt.executeUpdate();
				}
	//立项
	public int messageConfirm(Connection con,String delIds)throws Exception{
		String sql="update message set is_confirm='已立项'  where id in("+delIds+")";
		PreparedStatement pstmt=con.prepareStatement(sql);
		return pstmt.executeUpdate();
	}
	//立项全部
	public int messageConfirmAll(Connection con) throws SQLException {
		String sql="update message set is_confirm='已立项'  ";
		PreparedStatement pstmt=con.prepareStatement(sql);
		return pstmt.executeUpdate();
	}
	//取消立项
	public int messageConcelConfirm(Connection con,String delIds)throws Exception{
		String sql="update message set is_confirm='未立项'  where id in("+delIds+")";
		PreparedStatement pstmt=con.prepareStatement(sql);
		return pstmt.executeUpdate();
	}
	//取消全部立项
		public int messageConcelAllConfirm(Connection con)throws Exception{
			String sql="update message set is_confirm='未立项' ";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}
	//提交
		public int messageSubmit(Connection con,String delIds)throws Exception{
			String sql="update message set submit='已提交'  where id in("+delIds+")";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}
	//提交全部
	public int messageSubmitAll(Connection con) throws SQLException {
		String sql="update message set submit='已提交'  ";
		PreparedStatement pstmt=con.prepareStatement(sql);
		return pstmt.executeUpdate();
	}
	//取消提交
			public int cancelMessageSubmit(Connection con,String delIds)throws Exception{
				String sql="update message set submit='未提交'  where id in("+delIds+")";
				PreparedStatement pstmt=con.prepareStatement(sql);
				return pstmt.executeUpdate();
			}
	//取消全部提交		
			public int cancelAllMessageSubmit(Connection con)throws Exception{
				String sql="update message set submit='未提交' ";
				PreparedStatement pstmt=con.prepareStatement(sql);
				return pstmt.executeUpdate();
			}
	//结项
		public int messageEnd(Connection con,String delIds)throws Exception{
			String sql="update message set is_end='已结项'  where id in("+delIds+")";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}
		//结项全部
		public int messageEndAll(Connection con) throws SQLException {
			String sql="update message set is_end='已结项'";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}	
		//取消结项
		public int messageConcelEnd(Connection con,String delIds)throws Exception{
			String sql="update message set is_end='未结项'  where id in("+delIds+")";
			PreparedStatement pstmt=con.prepareStatement(sql);
			return pstmt.executeUpdate();
		}
		//取消全部结项
				public int messageConcelAllEnd(Connection con)throws Exception{
					String sql="update message set is_end='未结项' ";
					PreparedStatement pstmt=con.prepareStatement(sql);
					return pstmt.executeUpdate();
				}
	//添加
	public int messageAdd(Connection con,Message message)throws Exception{
		String sql="insert into message values(null, ?, ?, ?, ?, ?, ?, ?, ?, ?, '未立项','未提交', '未结项', '未获奖',?,?,?,'一般')";
		PreparedStatement pstmt=con.prepareStatement(sql);
		pstmt.setString(1, message.getChoose());
		pstmt.setString(2, message.getName());
		pstmt.setString(3, message.getForm());
		pstmt.setString(4, message.getHead());
		pstmt.setString(5, message.getPosition());
		pstmt.setString(6, message.getWorkspace());
		pstmt.setString(7, message.getTeleph());
		pstmt.setString(8, message.getMembers());
		pstmt.setString(9, message.getM_desc());
		pstmt.setString(10, message.getDate());
		pstmt.setString(11, message.getCid());
		pstmt.setString(12, message.getAid());
		return pstmt.executeUpdate();
	}
	//修改
	public int messageModify(Connection con,Message message)throws Exception{
		String sql="update message set choose=?, name=?, form=?, head=?, position=?, workspace=?, teleph=?, members=?, m_desc=?, date=?, cid=?, aid=? where id=?";
		PreparedStatement pstmt=con.prepareStatement(sql);
		pstmt.setString(1, message.getChoose());
		pstmt.setString(2, message.getName());
		pstmt.setString(3, message.getForm());
		pstmt.setString(4, message.getHead());
		pstmt.setString(5, message.getPosition());
		pstmt.setString(6, message.getWorkspace());
		pstmt.setString(7, message.getTeleph());
		pstmt.setString(8, message.getMembers());
		pstmt.setString(9, message.getM_desc());
		pstmt.setString(10, message.getDate());
		pstmt.setString(11, message.getCid());
		pstmt.setString(12, message.getAid());
		pstmt.setInt(13, message.getId());
		return pstmt.executeUpdate();
	}
	//导出选择信息
	public List<Message> exportMessage(Connection con, String delIds) throws SQLException {
		QueryRunner runner = new QueryRunner();
		String sql = "select * from message where id in("+delIds+")";
		//String sql = "select * from message where id=1";
		List<Message> exportMessage = runner.query(con, sql, new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}
	//清空数据表
	public int messageAllDelete(Connection con) throws SQLException {
		//String sql="delete from message ";
		String sql="truncate table message ";
		
		PreparedStatement pstmt=con.prepareStatement(sql);
		return pstmt.executeUpdate();
	}
	//导出所有获奖
	public List<Message> exportAllPrizeMessage(Connection con) throws SQLException {
		QueryRunner runner = new QueryRunner();
		String sql = "select * from message where is_confirm='已立项' and is_end='已结项' and not prize='未获奖'";
		//String sql = "select * from message where id=1";
		List<Message> exportMessage = runner.query(con, sql, new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}
	//导出所有结项
	public List<Message> exportAllEndMessage(Connection con) throws SQLException {
		QueryRunner runner = new QueryRunner();
		String sql = "select * from message where is_confirm='已立项' and is_end='已结项'";
		//String sql = "select * from message where id=1";
		List<Message> exportMessage = runner.query(con, sql, new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}
	//导出所有立项
	public List<Message> exportAllConfirmMessage(Connection con) throws SQLException {
		QueryRunner runner = new QueryRunner();
		String sql = "select * from message where is_confirm='已立项'";
		//String sql = "select * from message where id=1";
		List<Message> exportMessage = runner.query(con, sql, new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}
	//导出所有信息
	public List<Message> exportAllMessage(Connection con) throws SQLException {
		QueryRunner runner = new QueryRunner();
		String sql = "select * from message";
		//String sql = "select * from message where id=1";
		List<Message> exportMessage = runner.query(con, sql, new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}
	//导出特等奖
	public List<Message> exportAllPrizeOMessage(Connection con) throws SQLException {
		QueryRunner runner = new QueryRunner();
		String sql = "select * from message where is_confirm='已立项' and is_end='已结项' and prize='特等奖'";
		//String sql = "select * from message where id=1";
		List<Message> exportMessage = runner.query(con, sql, new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}
	//导出一等奖
	public List<Message> exportAllPrizeTMessage(Connection con) throws SQLException {
		QueryRunner runner = new QueryRunner();
		String sql = "select * from message where is_confirm='已立项' and is_end='已结项' and prize='一等奖'";
		//String sql = "select * from message where id=1";
		List<Message> exportMessage = runner.query(con, sql, new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}
	//导出二等奖
	public List<Message> exportAllPrizeFMessage(Connection con) throws SQLException {
		QueryRunner runner = new QueryRunner();
		String sql = "select * from message where is_confirm='已立项' and is_end='已结项' and prize='二等奖'";
		//String sql = "select * from message where id=1";
		List<Message> exportMessage = runner.query(con, sql, new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}
	//导出搜索数据
	public List<Message> exportSearchMessage(Connection con,Message message) throws SQLException {
		QueryRunner runner = new QueryRunner();
		StringBuffer sb=new StringBuffer("select * from message");
		//立项中搜索数据导出
		if(StringUtil.isNotEmpty(message.getIs_confirm())){
			sb.append(" and is_confirm like '%"+message.getIs_confirm()+"%' ");
		}
		//提交中搜索数据导出
		if(StringUtil.isNotEmpty(message.getSubmit())){
			sb.append(" and submit like '%"+message.getSubmit()+"%' ");
		}
		//结项中搜索数据导出
		if(StringUtil.isNotEmpty(message.getIs_end())){
			sb.append(" and is_end like '%"+message.getIs_end()+"%' ");
		}
		//获奖中搜索数据导出		
		if(StringUtil.isNotEmpty(message.getHead())){
			sb.append(" and head like '%"+message.getHead()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getWorkspace())){
			sb.append(" and workspace like '%"+message.getWorkspace()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getName())){
			sb.append(" and name like '%"+message.getName()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getMembers())){
			sb.append(" and members like '%"+message.getMembers()+"%' ");
		}
		if(StringUtil.isNotEmpty(message.getAid())){
			sb.append(" and aid like '%"+message.getAid()+"%' ");
		}
		List<Message> exportMessage = runner.query(con, sb.toString().replaceFirst("and", "where"), new BeanListHandler<Message>(Message.class));
		return exportMessage;
	}


	
}
